function stealth:detect/.
execute if score @s[tag=!sees_player] detection matches 1.. run scoreboard players remove @s detection 1
tag @s remove sees_player
execute unless score @s detection matches 0.. run scoreboard players set @s detection 0
execute if score @s detection matches 0 run function stealth:guard/undetected_color
execute if entity @s[tag=order] run data modify entity @s Glowing set value 1
execute if entity @s[tag=crow_seen] run data modify entity @s Glowing set value 1
execute if entity @s[tag=armored_last] run data modify entity @s Glowing set value 1
execute if score @s detection matches 1.. run function stealth:guard/detected_color
execute if score @s detection matches ..80 run tag @s remove ding
execute if entity @s[tag=on_path] run function nav:on_path
execute if score @s detection matches 161.. run function stealth:restart_guard
data modify entity @s Fire set value -1
tag @s remove crow_seen
execute if entity @s[tag=armored_last] run function stealth:guard/armored
execute if entity @s[tag=doing_action] run function nav:action/cooldown